﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using STT.Layer.Connection;
using System.Data;
namespace STT.Home
{
    public partial class UcKhoaHoc : System.Web.UI.UserControl
    {
        ToolBox tb = new ToolBox();
        protected void Page_Load(object sender, EventArgs e)
        {
            LoadKh();
            LoadKHLQ();
        }
        private void LoadKh()
        {
            if (Request.QueryString.Get("key") == null)
            {
                dllkhoahoc.DataSource = tb.GetDataTable2("TbKhoaHoc_GetTopKH");
                dllkhoahoc.DataBind();
            }
            else 
            {
                dllkhoahoc.DataSource = tb.GetDataTableById2("TbKhoaHoc_SelectByID", Request.QueryString.Get("key").ToString());
                dllkhoahoc.DataBind();
            }
        }
        private void LoadKHLQ()
        {
            //DataTable dt = tb.GetDataTable2("TbKhoaHoc_SelectAll");
            //cpl.PageSize = 5;
            //cpl.DataSource = dt.DefaultView;
            //cpl.BindToControl = dllkhoahoc2;
            //dllkhoahoc2.DataSource = cpl.DataSourcePaged;
            //dllkhoahoc2.DataBind();
            dllkhoahoc2.DataSource = tb.GetDataTable2("TbKhoaHoc_SelectTop5");
            dllkhoahoc2.DataBind();
        }
    }
}